package ${projPackage.projPackage}.${projPackage.entity};
<#-- 下面是循环创建非通用的 import -->
<#if tableInfo.imports??>
<#list tableInfo.imports as item>
${item}
</#list>
</#if>
<#--
    将 common jar 包中的 TableInfo 对象集合 CodeGeneratorUtils.ProjPackage
    生成实体类对象并带有建造者模式
    TableInfo必填字段：modelClassName，fieldInfoList
    FieldInfo必填字段：attributeName，javaType
-->
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
/**
 * 版本号：20240401
 * 由 chanchaw 创建于 ${.now}，实现功能如下：
 * 1. 实现接口 Serializable
 * 2. 无参构造函数
 * 3. 建造者模式
 * 4. getter,setter,toString()
 * <#if tableInfo.remarks??>${tableInfo.remarks}</#if>
 */
public class ${tableInfo.modelClassName} implements Serializable {
    public ${tableInfo.modelClassName}() {}
    private static final long serialVersionUID = 1L;

    <#-- 遍历字段声明私有属性 -->
    <#list tableInfo.fieldInfoList as fieldInfo>
    <#if fieldInfo.javaType = "java.util.Date">
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    </#if>
    <#if fieldInfo.javaType = "Date">
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    </#if>
    private ${fieldInfo.javaType} ${fieldInfo.attributeName};<#if fieldInfo.remarks??>//${fieldInfo.remarks}</#if>
    </#list>

    <#-- 遍历字段声明 getter,setter -->
    <#list tableInfo.fieldInfoList as fieldInfo>
    public ${fieldInfo.javaType} get${fieldInfo.attributeName?cap_first}(){return this.${fieldInfo.attributeName};}
    public void set${fieldInfo.attributeName?cap_first}(${fieldInfo.javaType} ${fieldInfo.attributeName}){this.${fieldInfo.attributeName} = ${fieldInfo.attributeName};}
    </#list>


    @Override
    public String toString() {
        return "${tableInfo.modelClassName}{" +
        <#list tableInfo.fieldInfoList as fieldInfo>
        ",${fieldInfo.attributeName}='" + ${fieldInfo.attributeName} + '\'' +
        </#list>
        '}';
    }

    public static class Builder{
        <#-- 遍历字段声明私有属性 -->
        <#list tableInfo.fieldInfoList as fieldInfo>
        private ${fieldInfo.javaType} ${fieldInfo.attributeName};
        </#list>

        <#-- 遍历字段声明 build 过程中的每个属性 -->
        <#list tableInfo.fieldInfoList as fieldInfo>
        public Builder ${fieldInfo.attributeName}(${fieldInfo.javaType} ${fieldInfo.attributeName}){this.${fieldInfo.attributeName} = ${fieldInfo.attributeName};return this;}
        </#list>
        public ${tableInfo.modelClassName} build(){
            return new ${tableInfo.modelClassName}(this);
        }
    }

    public static Builder builder(){return new Builder();}
    public ${tableInfo.modelClassName}(Builder builder){
    <#list tableInfo.fieldInfoList as fieldInfo>
        this.${fieldInfo.attributeName} = builder.${fieldInfo.attributeName};
    </#list>
    }
    /**
     * 自定义代码请写在此处之后
     */
}
